package com.Input.KeyBoard;

import com.Input.InputManager;
import javafx.event.EventHandler;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;

import java.util.concurrent.ConcurrentLinkedQueue;

public class KeyRelease implements EventHandler<KeyEvent> {
    private final ConcurrentLinkedQueue<KeyCode> queue = new ConcurrentLinkedQueue<>();
    @Override
    public void handle(KeyEvent keyEvent) {
        KeyCode code = keyEvent.getCode();
        InputManager.getPressed().remove(code);
        queue.add(code);
    }
    public KeyCode pollEvent() {
        return queue.poll();
    }

}
